#include"AVLtree.hh"
#include"RBTree.hh"
#include<ctime>
#include<cstdlib>

void TestAVLTree()
{
	//int a[] = { 16,3,7,11,9,26,18,14,15 };
	//cout << sizeof(a)/sizeof(a[0]) << endl;
	int a[] = { 4 ,2,6,1,3,5,15,7,16,14 };
	AVLTree<int, int> t;
	for (auto e : a)
	{
		t.Insert(make_pair(e, e));
	}
	t.Inorder();
	cout << t.IsBalance() << endl;
}
void TestRBTree()
{
	srand((unsigned long)time(0));
	int a[1000];
	for (int i = 0; i < 1000; i++)
	{
		a[i] = rand();
	}
	//int a[] = { 16,3,7,11,9,26,18,14,15 };
	RBTree<int, int> t;
	for (auto e : a)
	{
		t.Insert(make_pair(e, e));
	}
	t.Inorder();
	cout << t.IsValidRBTree() << endl;
}
int main()
{
	//TestAVLTree();
	TestRBTree();

	return 0;
}